//Package public is free
package public

import (
	"fmt"
	"os/exec"
	"runtime"
)

// ShutDownPc cmd
func ShutDownPc() {

	if runtime.GOOS == "windows" {

		fmt.Println("ShutDownPc")

		//60*5
		arg := []string{"-s", "-t", "300"}
		cmd := exec.Command("shutdown", arg...)
		d, err := cmd.CombinedOutput()
		if err != nil {
			fmt.Println("Error:", err)
			return
		}
		fmt.Println(string(d))

	}

}

// RunBatCommand cmd
func RunBatCommand(batPath string) int {
	if runtime.GOOS == "windows" {

		fmt.Println("window_bat")
		cmd := exec.Command("cmd.exe", "/C", batPath)
		d, err := cmd.CombinedOutput()
		if err != nil {
			fmt.Println("Error:", err)
			return -1
		}
		fmt.Println(string(d))

	}
	return 0
}
